package com.koylu.faces.security.user;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

public class UserManagerImpl implements UserManager {

	private static final String USER = "_access_manager_session_user_"; 
	
	public void setUser(User user){
		(((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession()).setAttribute(USER, user);
	}
	
	public User getUser(){
		return (User)(((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession()).getAttribute(USER);
	}
}
